<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>我的订单</title>
		<link rel="stylesheet" href="./Public/Home/bootstrap-3.3.5-dist/css/bootstrap.min.css" />
		<script type="text/javascript" src='./Public/Home/jquery.min.js'></script>
		<script type="text/javascript" src='./Public/Home/bootstrap-3.3.5-dist/js/bootstrap.min.js'></script>
		<link rel="stylesheet" href="./Public/Home/css/myIndent.css" />
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/ifont.css"/>
		<script type="text/javascript" src='./Public/Home/js/index.js'></script>
	</head>
	<body>
		<!--公共顶部-->
		<div class="tp _w100">
			<div class="top _certain">
				<ul class="top_l">
					<li><a href="">时尚商城</a></li>
					<li class="ip">
						<a href=""><i class="glyphicon glyphicon-phone"></i>手机优购<span class="caret"></span></a>
						<div class="wx">
									<div class="dv1 fl"></div>
									<a href=""><div class="dv2 fl"></div></a>
									<a href=""><div class="dv3 fl"></div></a>
									<div class="la fl">安装优购客户端</div>
						</div>
					</li>
				</ul>
				<ul class="top_r">					
					<li class="fz">
							<a class="link" href="">
							更多<span class="caret">	
							<ul class="hz" style="z-index: 100;" >
								<li><a href="">收藏优购</a></li>
								<li>&nbsp;&nbsp;<a href="">帮助</a></li>
							</ul>
						</a>
					</li>
					<li class="cil">
							<a class="link fy" href="" style="z-index: 100;">
							公告<span class="caret"></span>
							<ul class="hiy" style="z-index: 10;" >
								<li><a href="">新年翻新样 运动￥89起</a></li>
								<li><a href=""> 精美舒适低跟靴 ￥99起 </a></li>
								<li><a href=""> 首尔卫衣特卖场 70%OFF </a></li>
								<li><a href=""> 优购首尔站 停发货详情 </a></li>
								<li><a href=""> 提醒会员谨防诈骗电话 </a></li>
							</ul>
							</a>
						</li>
					<a class="link" href="">
						我的订单						
					</a>&nbsp;&nbsp;					
					<a class="link fx" href="">
							我的优购<span class="caret"></span>
							<div class="hid">&nbsp;&nbsp;我的收藏</div>
						</a>
					<a class="link" href="javascript:;">|</a>&nbsp;&nbsp;
					 {{if value="isset($_SESSION['uid'])"}}
							<a class="link kt" href="">欢迎 &nbsp;
								<span class="red" style="">{{$_SESSION['email']}}</span>&nbsp;回来
							</a>&nbsp;&nbsp;
							 <a class="link" href="{{U('Login/out')}}">退出</a>
						{{else}}
						 <a class="link kt" href="{{U('Login/index')}}">登录</a>&nbsp;&nbsp;
						 <a class="link" href="{{U('Reg/index')}}">注册 &nbsp;&nbsp;|&nbsp;&nbsp; </a>
						 {{endif}} 					 																
				</ul>
				
			</div>
		</div>
			<!--公共顶部结束-->
			<!--订单列表开始-->
			<div class="lis _certain">
				<ul class="tab">
					<li class="fir"><input type="checkbox" name="" id="" />&nbsp;&nbsp;全选</li>
					<li class="big">商品名称</li>
					<li class="normal">颜色尺码</li>
					<li class="normal">单价</li>
					<li class="normal">数量</li>
					<li class="normal">小计</li>
					<li class="last">操作</li>
				</ul>
				{{foreach from="$goods" key="$k" value="$v"}}
				<ul class="menu tab">
					<li class="fir">
						<input type="checkbox" name="" id="" />&nbsp;&nbsp;
						<a href="">
							<img src="{{$v['options']['listview']}}" alt="" style="width: 100%;height: 100%;"/>
						</a>
					</li>
					<li class="big">
						<p class="jz"><a href="">{{$v['name']}}</a></p>
					</li>
					<li class="normal">
						<p class="p1">颜色：<span>{{$v['options']['color']}}</span></p>
						<p class="p2">尺码：<span>{{$v['options']['size']}}</span></p>
					</li>
					<li class="normal">
						<p class="p1"><span class="pice">{{$v['price']}}</span></p>
						<p class="p2"><span style="background: red;color: white;padding-left: 5px;padding-right: 5px;">限时抢</span></p>
					</li>
					<li class="normal spe">
						
						<div class="fl decre" style="font-size: 30px;margin-left: 22px;cursor: pointer;">-</div>
						<input class="fl" type="text" value="{{$v['num']}}" style="text-indent: 7px;color: #606060;margin-left: 5px;"/>
						<div class="fl incre" style="font-size: 20px;margin-left: 5px;cursor: pointer;">+</div> 
					
					</li>
					<li class="normal total" style="color: red;">{{$v['total']}}</li>
					<li class="last">
						<p class="p1"><a href="">移入收藏夹</a></p>
						<p class="p2"><a href="javascript:;" class="del">删除</a></p>
						<input type="hidden" name="sid" class="" value="{{$k}}" class="some"/>
					</li>
				</ul>
				{{endforeach}}
				<script type="text/javascript">
					  //购买数量的加减
			        $(function(){			        	
			        	$('.decre').click(function(){
			        		var input=$(this).siblings('input');
			        		var num =input.val()*1;
							num--;
							if(num<0) return;
							input.val(num);
							//点击减号时获得商品单价和商品数量两者相乘计算总价
							var pice = $('.pice').html();
							var total = parseInt(pice*num);
							//找父级找兄弟赋值总价
							$(this).parent().siblings('.total').html(total);
							//所有货品的总价
							//先获得原来的总价
							var money = $(this).parents('ul').siblings('.account').find('.lasted').html();
							//点击之后新的总价
							var newmoney = money-pice;
							//将新的总价格赋值回去
							$(this).parents('ul').siblings('.account').find('.lasted').html(newmoney);
							//异步修改
							//抓取input表单的所有内容
							//抓取sid
							var hData = $(this).parent().siblings('.last').find('input').val();
							//抓取商品数量
							var nData = $(this).siblings('input').val();
							//发送异步
							$.ajax({
								type:"post",
								url:update_path,
								data:{sid:hData,num:nData},
								dataType:'json',
								success:function(phpData){
									
								}
							});
							
							//阻止表单提交
							return false;
			        	});
						$('.incre').click(function(){
			        		var input=$(this).siblings('input');
			        		var num =input.val()*1;
							num++;
							input.val(num);
							//点击加号时获得商品单价和商品数量两者相乘计算总价
							var pice = $('.pice').html();
							var total = parseInt(pice*num);
							//找父级找兄弟赋值总价
							$(this).parent().siblings('.total').html(total);
							//所有货品的总价
							//先获得原来的总价
							var money = $(this).parents('ul').siblings('.account').find('.lasted').html();
							//点击之后新的总价
							var newmoney = parseInt(money)+parseInt(pice);
							//将新的总价格赋值回去
							$(this).parents('ul').siblings('.account').find('.lasted').html(newmoney);
							//异步修改
							//抓取input表单的所有内容
							//抓取sid
							var hData = $(this).parent().siblings('.last').find('input').val();
							//抓取商品数量
							var nData = $(this).siblings('input').val();
							//发送异步
							$.ajax({
								type:"post",
								url:update_path,
								data:{sid:hData,num:nData},
								dataType:'json',
								success:function(phpData){
									
								}
							});
							
							//阻止表单提交
							return false;
			        	});
			        	
			        	
			        })

				</script>
				
				<ul class="account _certain">
					<div class="bt">					
						<a href="{{U('Index/index')}}" class="btn btn-default">继续购物</a>					
						<a href="javascript:;" class="btn btn-default clear">清空购物车</a>
					</div>
					<div class="js ">
						<a href="{{U('Refer/index')}}">去结算</a>
					</div>
					<p class="total ">
						<span class="lef">总计(不含运费)：￥</span>
						<span class="rig lasted">{{$totals}}</span>
					</p>
				</ul>
			</div>
		</div>
		<!--订单列表结束-->
		<div class="_w100">
			<div class="bottom _certain">
				<p>
					Copyright © 2011-2014 Yougou Technology Co., Ltd. 					<a href=""><span>粤ICP备09070608号-4</span></a>
					 增值电信业务经营许可证：<a href=""><span>粤 B2-20090203 </span></a>
				</p>
			</div>
		</div>
		
		<script type="text/javascript">
			//异步删除地址
			var del_path = "{{U('Indent/del')}}";	
			//异步修改的地址
			var update_path = "{{U('Indent/edit')}}";
			//清空购物车地址
			var clear_path = "{{U('Indent/clear')}}";
		</script>
		
		
		
	</body>
</html>
